<?php
namespace app\api\model;
use think\Db;
use think\Request;
use \app\api\common\Common;

class ImagesModel extends Common
{
    public function getSlideImg(){//轮播图模块图片
        $result = Db::table("img_slide")->select();
        $this->Json('200',$result,'','数据获取成功!!');
    }

    public function getUserImg(){//试用模块图片
        $result = Db::table("img_user")->select();
        $this->Json('200',$result,'','数据获取成功!');
    }

    public function getReportImg(){//报告模块图片
        // $result = Db::table("img_report")->select();
        // $this->Json('200',$result,'','数据获取成功!');
        if (empty($start)&&empty($num)){
            $result = Db::table("img_report")->select();
            $this->Json('200',$result,'','数据获取成功!');
        }else{
            $count = Db::table('img_report')->count();//总数 
            $result = Db::table("img_report")
            ->field( "id,imginfo,imgsrc")
            ->limit($start,$num)//从start查询，查询num条
            ->select();
            // print_r($result);
            $this->Json('200', $result, $count,'数据获取成功!');
            // return $result;
        }
    }

    public function getGuidImg(){//导购模块图片
        // $result = Db::table("img_guid")->select();
        // $this->Json('200',$result,'','数据获取成功!');
        if (empty($start)&&empty($num)){
            $result = Db::table("img_guid")->select();
            $this->Json('200',$result,'','数据获取成功!');
        }else{
            $count = Db::table('img_guid')->count();//总数 
            $result = Db::table("img_guid")
            ->field( "id,imginfo,imgsrc")
            ->limit($start,$num)//从start查询，查询num条
            ->select();
            // print_r($result);
            $this->Json('200', $result, $count,'数据获取成功!');
            // return $result;
        }
    }

    public function getPlayImg($start,$num){//酷玩模块图片
        if (empty($start)&&empty($num)){
            $result = Db::table("img_play")->select();
            $this->Json('200',$result,'','数据获取成功!');
        }else{
            $count = Db::table('img_play')->count();//总数 
            $result = Db::table("img_play")
            ->field( "id,imginfo,imgdescribe,price,imgsrc")
            ->limit($start,$num)//从start查询，查询num条
            ->select();
            // print_r($result);
            $this->Json('200', $result, $count,'数据获取成功!');
            // return $result;
        }
        
    }
}